<template>
  <a-modal :open="open" width="600px" title="皮试确认" destroy-on-close centered :footer="null" @cancel="onCancel">
    <div class="flex items-center">
      <div>【{{ rowData.allergyCode }}】</div>
      <MedicineInfo class="inline-flex w-auto" :value="{ mc: rowData.drugName, gg: rowData.gg, cj: rowData.cj }" />
    </div>
    <div class="mt-3">
      <span>已在</span>
      <span class="px-1"> {{ rowData.expirationTime }} </span>
      <span>检测为阴性，是否再次皮试？</span>
    </div>
    <div class="mt-4">
      <a-textarea v-model:value="reasonText" :rows="5" placeholder="若不用皮试，请输入原因" />
    </div>
    <div class="flex justify-end mt-4 mb-2">
      <a-button class="mr-4" @click="onClickNo">不用</a-button>
      <a-button type="primary" @click="onClickUse">再次皮试</a-button>
    </div>
  </a-modal>
</template>
<script setup>
import { message } from 'ant-design-vue'

const emit = defineEmits(['update:open', 'success'])
defineProps({
  open: {
    type: Boolean,
    default: false
  },
  rowData: {
    type: Object,
    default: () => ({})
  }
})
const reasonText = ref('')
const onClickNo = () => {
  if (!reasonText.value) {
    message.error('请输入原因')
  } else {
    emit('success', false, reasonText.value)
  }
}
const onClickUse = () => {
  emit('success', true)
}
const onCancel = () => {
  emit('update:open', false)
}
</script>
<style lang="less" scoped></style>
